Array.prototype._map = function (Fn = function () {}) {
  // this指向的是当前array实例
  const len = this.length;
  const result = new Array(len);
  // 可以兼容空占位情况
  for (let i = 0; i < len; i++) {
    if (this[i]) {
      // Function.call(上下文,map参数val,index,array)
      result[i] = Fn.call(this, this[i], i, this);
    }
  }
  return result;
};

console.log([1, , 2]._map((i) => i * 2));

// [1, 2].map((val, idx, array), context);
